using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace WebManager.Manager.Module
{
    public partial class Edit : System.Web.UI.Page
    {
        string MID = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            MID = HttpContext.Current.Request.QueryString["MID"];
            if (!Page.IsPostBack)
            {
                LYQ.BLL.SysType bll = new LYQ.BLL.SysType();
                LYQ.Model.SysType model = bll.GetModel(MID);

                txtTName.Text = model.TName;
                if (model.Container)
                {
                    txtContainer.Checked = true;
                }
                else
                {
                    txtContainer.Checked = false;
                }

                txtTDescription.Text = model.TDescription;
                txtTControlName.Text = model.TControlName;
                txtTControlPath.Text = model.TControlPath;
                txtTID.Text = model.TID;


            }
        }

        protected void Cancel_Click(object sender, EventArgs e)
        {
            string url = URLUtility.UrlBase + "/WebManager/manager/Module/List.aspx";
            Page.Response.Redirect(url);
        }

        protected void Save_Click(object sender, EventArgs e)
        {
            LYQ.BLL.SysType bll = new LYQ.BLL.SysType();
            LYQ.Model.SysType model = bll.GetModel(MID);

            model.TName = txtTName.Text;
            if (txtContainer.Checked)
            {
                model.Container = true;
            }
            else
            {
                model.Container = false;
            }

            model.TDescription = txtTDescription.Text;
            model.TControlName = txtTControlName.Text;
            model.TControlPath = txtTControlPath.Text;
            model.TID = txtTID.Text;

            bll.Update(model);
            string url = URLUtility.UrlBase + "/WebManager/manager/Module/List.aspx";
            Page.Response.Redirect(url);

        }
    }
}
